import React from 'react'
import { HashRouter, Redirect, Route, Switch } from 'react-router-dom'
import cookie from 'react-cookies'
import Login from '../views/login/Login'
import SandBox from '../views/sandbox/SandBox'
export default function IndexRouter() {
  return (
    <div>
      <HashRouter>
        <Switch>
          <Route path='/login' component={Login}></Route>
          {/* <Route path='/' component={SandBox}></Route> */}
          <Route path='/' render={() =>
            cookie.load('usertoken') ? <SandBox></SandBox> : <Redirect to='/login'></Redirect>
          }></Route>
        </Switch>
      </HashRouter>
    </div>
  )
}
